package factories;

import dataContracts.*;
import models.FileInfo;
import models.statistics.*;

public class StatisticsFactory implements IStatisticsFactory {
    @Override
    public LZ77Statistics create(LZ77CompressingStatistics statistics, FileInfo fileInfo) {
        return new LZ77Statistics(statistics.getId(), statistics.numberOfFactors,
                statistics.compressingTimeInMilliseconds, fileInfo);
    }

    @Override
    public LZMAStatistics create(LZCompressingStatistics statistics, FileInfo fileInfo) {
        return new LZMAStatistics(statistics.getId(), statistics.numberOfFactors,
                statistics.compressingTimeInMilliseconds, fileInfo);
    }

    @Override
    public LZWStatistics create(LZWCompressingStatistics statistics, FileInfo fileInfo) {
        return new LZWStatistics(statistics.getId(), statistics.numberOfFactors,
                statistics.compressingTimeInMilliseconds, fileInfo);
    }

    @Override
    public SLPClassicStatistics createSLPClassic(AvlSLPBuildingStatistics statistics, FileInfo fileInfo) {
        return new SLPClassicStatistics(statistics.getId(),
                statistics.compressedSize,
                statistics.slpBuildingTimeInMilliseconds,
                statistics.runningConfiguration.dataFactoryType.toString(),
                statistics.rebalanceCount,
                statistics.height, fileInfo);
    }

    @Override
    public SLPOptimalStatistics createSLPOptimal(AvlSLPBuildingStatistics statistics, FileInfo fileInfo) {
        return new SLPOptimalStatistics(statistics.getId(),
                statistics.compressedSize,
                statistics.slpBuildingTimeInMilliseconds,
                statistics.runningConfiguration.dataFactoryType.toString(),
                statistics.rebalanceCount,
                statistics.height, fileInfo);
    }

    @Override
    public SLPCartesianStatistics create(CartesianSLPBuildingStatistics statistics, FileInfo fileInfo) {
        return new SLPCartesianStatistics(statistics.getId(), statistics.slpBuildingTimeInMilliseconds,
                statistics.length, statistics.countRules, statistics.height, fileInfo);
    }

}
